/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sn.gandal.mobile.kalpet.persistence;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * @version V 1.0 01/03/2010
 * @author SOWDIOMYERO
 */
@Entity
@Table(name = "gestionnaire", catalog = "kmobile", schema = "")
@NamedQueries({
    @NamedQuery(name = "Gestionnaire.findAll", query = "SELECT g FROM Gestionnaire g"),
    @NamedQuery(name = "Gestionnaire.findById", query = "SELECT g FROM Gestionnaire g WHERE g.id = :id"),
    @NamedQuery(name = "Gestionnaire.findByNom", query = "SELECT g FROM Gestionnaire g WHERE g.nom = :nom"),
    @NamedQuery(name = "Gestionnaire.findByPrenom", query = "SELECT g FROM Gestionnaire g WHERE g.prenom = :prenom"),
    @NamedQuery(name = "Gestionnaire.findByMatricule", query = "SELECT g FROM Gestionnaire g WHERE g.matricule = :matricule"),
    @NamedQuery(name = "Gestionnaire.findByDateCreated", query = "SELECT g FROM Gestionnaire g WHERE g.dateCreated = :dateCreated"),
    @NamedQuery(name = "Gestionnaire.findByDateUpdated", query = "SELECT g FROM Gestionnaire g WHERE g.dateUpdated = :dateUpdated")})
public class Gestionnaire implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nom", nullable = false, length = 20)
    private String nom;
    @Basic(optional = false)
    @Column(name = "prenom", nullable = false, length = 30)
    private String prenom;
    @Basic(optional = false)
    @Column(name = "matricule", nullable = false)
    private int matricule;
    @Basic(optional = false)
    @Column(name = "dateCreated", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreated;
    @Basic(optional = false)
    @Column(name = "dateUpdated", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateUpdated;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "gestionnaire", fetch = FetchType.LAZY)
    private List<Cartes> cartesList;

    public Gestionnaire() {
    }

    public Gestionnaire(Integer id) {
        this.id = id;
    }

    public Gestionnaire(Integer id, String nom, String prenom, int matricule, Date dateCreated, Date dateUpdated) {
        this.id = id;
        this.nom = nom;
        this.prenom = prenom;
        this.matricule = matricule;
        this.dateCreated = dateCreated;
        this.dateUpdated = dateUpdated;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public int getMatricule() {
        return matricule;
    }

    public void setMatricule(int matricule) {
        this.matricule = matricule;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Date getDateUpdated() {
        return dateUpdated;
    }

    public void setDateUpdated(Date dateUpdated) {
        this.dateUpdated = dateUpdated;
    }

    public List<Cartes> getCartesList() {
        return cartesList;
    }

    public void setCartesList(List<Cartes> cartesList) {
        this.cartesList = cartesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Gestionnaire)) {
            return false;
        }
        Gestionnaire other = (Gestionnaire) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sn.gandal.mobile.kalpet.persistence.Gestionnaire[id=" + id + "]";
    }

}
